package com.mlxg.enmu;

/**
 * @author zcy
 * @date 2025/5/22 15:01
 * 展商参加过的展会
 */
public enum ExpoType {
    NINETEENTH(19, 17),
    TWENTIETH(20, 18);

    private final Integer id;
    private final Integer expoId;

    ExpoType(Integer id, Integer expoId) {
        this.id = id;
        this.expoId = expoId;
    }

    public Integer getId() {
        return id;
    }

    public Integer getExpoId() {
        return expoId;
    }

    // 根据 id 获取 ExpoId
    public static Integer getExpoIdById(Integer id) {
        for (ExpoType type : ExpoType.values()) {
            if (type.getId().equals(id)) {
                return type.getExpoId();
            }
        }
        throw new IllegalArgumentException("Invalid expo ID: " + id);
    }

    public static void main(String[] args) {
        // 测试
        System.out.println(ExpoType.getExpoIdById(19));  // 输出 17
        System.out.println(ExpoType.getExpoIdById(20));  // 输出 18
        // System.out.println(ExpoType.getExpoIdById(21));  // 会抛出异常
    }
}
